using UnityEngine;
using System.Collections;

public class FollowPlayer : MonoBehaviour {

    public Transform target;
    public int damp = 1;

    int status = 0; //Trocar por ENUM - 0 ativo, 1 morto;

	// Use this for initialization
	void Start () {
        target = GameObject.FindWithTag("Player").transform;
	
	}
	
	// Update is called once per frame
	void Update () {

        if (status == 0)
        {
            Quaternion rotate = Quaternion.LookRotation(target.position - transform.position);

            transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);

            transform.Translate(Vector3.forward * Time.deltaTime, Space.Self);
        }
	
	}

    void changeStatus(int temp)
    {
        status = temp;
    }
}
